import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Solution {
    public HashMap ElementSet(int[] nums) {
        HashMap<Integer, Integer> hashMap = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if(hashMap.containsKey(nums[i])){
                hashMap.put(nums[i],hashMap.get(nums[i])+1);
            }else{
                hashMap.put(nums[i],1);
            }
        }
        return hashMap;
    }

    public int majortyElement(int nums[]){
        HashMap<Integer,Integer> hashMap = ElementSet(nums);
        Map.Entry<Integer, Integer> majorityEntry = null;
        for (Map.Entry<Integer, Integer> entry : hashMap.entrySet()) {
            if(majorityEntry==null||entry.getValue() > majorityEntry.getValue()){
                majorityEntry = entry;
            }

        }
        return majorityEntry.getValue();

    }

}
